Conversation
Compute each pixel bound (py_min/py_max/px_min/px_max) via separate pixel_coordinates_2d_from calls and clamp against shape_native so a region that extends past the array edge no longer slices off-array. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AbstractArray2D.brightest_coordinate_in_region_frominautoarray/structures/arrays/uniform_2d.pyto compute each pixel bound (py_min,py_max,px_min,px_max) via four separatepixel_coordinates_2d_fromcalls instead of two paired calls — each call now passes a single scaled coordinate on the axis it maps to, which is less fragile than packing two coords of different meaning into one call.self.shape_nativeso regions that extend past the array edge no longer slice off-array.[py_min : py_max + 1, px_min : px_max + 1](inclusive end) and adjusts the brightest-pixel index recovery to match the new clamped bounds.Test plan
pytest test_autoarray/structures/arrays/test_uniform_2d.py -k "brightest_coordinate_in_region_from or brightest_sub_pixel_coordinate_in_region_from"— all 11 tests pass (6 pre-existing + 5 new).New tests added in
test_autoarray/structures/arrays/test_uniform_2d.py:test__brightest_coordinate_in_region_from__region_offset_from_origin__correct_peak_coordinatetest__brightest_coordinate_in_region_from__region_fully_offset_negative_quadrant__correct_peak_coordinatetest__brightest_coordinate_in_region_from__region_offset_positive_quadrant__correct_peak_coordinatetest__brightest_coordinate_in_region_from__region_clipped_to_array_bounds__correct_peak_coordinate(exercises the new clamp path)test__brightest_sub_pixel_coordinate_in_region_from__region_offset_from_origin__correct_sub_pixel_peak🤖 Generated with Claude Code